package com.qf.controller;

import com.qf.pojo.RevisitPojo;
import com.qf.service.RevisitService;
import com.qf.utils.ResultMsg;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Api(tags = "回访接口管理")
@RestController
@RequestMapping("/revisit")
@CrossOrigin
public class RevisitController {

    @Autowired
    RevisitService revisitService;

//    @GetMapping("/findAll")
//    public ResultMsg findAll(@Param("current") int current,@Param("pageSize") int pageSize){
//        return revisitService.findAll(current,pageSize);
//    }

    @GetMapping("/findAll")
    public ResultMsg findAll(@RequestParam Map<String,Object> maps){
        return revisitService.findAll(maps);
    }

//    @GetMapping("/findByStatus")
//    public ResultMsg findByStatus(@Param("revisitStatus") int revisitStatus,@Param("current") int current,@Param("pageSize") int pageSize){
//        return revisitService.findByStatus(revisitStatus,current,pageSize);
//    }
//
//    @GetMapping ("/findByDate")
//    public ResultMsg findByDate(@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("current") int current,@Param("pageSize") int pageSize){
//        return revisitService.findByDate(startTime,endTime,current,pageSize);
//    }


    @GetMapping("/delById/{revisitId}")
    public ResultMsg del(@PathVariable int revisitId){
        return revisitService.del(revisitId);
    }

    @GetMapping("/findOne/{revisitId}")
    public ResultMsg findOne(@PathVariable int revisitId){
        return revisitService.findOne(revisitId);
    }

    @PostMapping("/update")
    public ResultMsg update(@RequestBody RevisitPojo revisit){
        return revisitService.update(revisit);
    }

    @GetMapping ("/updateStatus/{revisitId}")
    public ResultMsg updateStatus(@PathVariable int revisitId){
        return revisitService.updateStatus(revisitId);
    }

    @PostMapping ("/add")
    public ResultMsg add(@RequestBody RevisitPojo revisit){

        return revisitService.add(revisit);
    }
}
